package BiShi.first;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            int n = sc.nextInt();

            int[] a = new int[n];
            double[] p = new double[n];
            for(int i = 0; i < n; i++){
                p[i] = sc.nextFloat();
            }
            for(int i = 0; i < n; i++){
                a[i] = sc.nextInt();
            }

            double[][] value = new double[n][2];
            for(int i = 0; i < n; i++){
                value[i] = new double[]{i+1, p[i]*a[i]/(i+1)};
            }
            Arrays.sort(value, (o1, o2) -> o1[1]-o2[1]>0?-1:1);
            double ans = 0;
            int  resbu = n;

            int i = 0;
            while (resbu > 0 && i < n) {
                if(resbu-value[i][0]>=0){
                    resbu-=value[i][0];
                    ans+=p[(int) value[i][0]-1] * a[(int) value[i][0]-1];
                }else{
                    i++;
                }
            }
            System.out.println(ans);
        }
    }
}



